import itertools
class Solution:
    def letterCombinations(self, digits: str):
        if not digits or len(digits) == 0:
            return []

        groupmap = [
            "abc",
            "def",
            "ghi",
            "jkl",
            "mno",
            "pqrs",
            "tuv",
            "wxyz"
        ]

        groups = [groupmap[int(d) - 2] for d in digits]
        res = ["".join(combination) for combination in itertools.product(*groups)]
        return res

x = Solution()
print(x.letterCombinations('23'))